package com.ruoyi.zhjd.exp.modules.exppmstester.service.impl;

import java.util.Map;

import com.ruoyi.zhjd.exp.modules.exppmstester.entity.ExpPmsTesterEntity;
import com.ruoyi.zhjd.exp.modules.exppmstester.mapper.ExpPmsTesterMapper;
import com.ruoyi.zhjd.exp.modules.exppmstester.service.ExpPmsTesterService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


/**
 * @ClassName: ExpPmsTesterServiceImpl
 * @Description: 路强仪业务接口实现
 * @author linhuawei
 * @since 2021-04-20
 */
@Service
public class ExpPmsTesterServiceImpl extends ServiceImpl<ExpPmsTesterMapper, ExpPmsTesterEntity>
        implements ExpPmsTesterService {

//    @Autowired
//    private BaseServiceComponent baseServiceComponent;

    @Override
    public IPage<ExpPmsTesterEntity> page(Map<String, Object> params) {
        // 设置查询条件
        QueryWrapper<ExpPmsTesterEntity> queryWrapper = new QueryWrapper<>();
        if (ObjectUtils.isNotEmpty(params.get("baseName"))) {
            queryWrapper.like("base_name", params.get("baseName"));
        }
        if (ObjectUtils.isNotEmpty(params.get("sampleName"))) {
            queryWrapper.like("sample_name", params.get("sampleName"));
        }
        if (ObjectUtils.isNotEmpty(params.get("sampleNo"))) {
            queryWrapper.like("sample_no", params.get("sampleNo"));
        }
        if (null != params.get("startTime")) {
            queryWrapper.ge("start_time", params.get("startTime"));
        }
        if (null != params.get("endTime")) {
            queryWrapper.le("start_time", params.get("endTime"));
        }
        queryWrapper.orderByDesc("start_time");

        // 执行查询操作
        IPage<ExpPmsTesterEntity> page = null;
        return baseMapper.selectPage(page, queryWrapper);
    }

}
